package com.wuseguang.springcloud.controller;


import com.wuseguang.springcloud.Filter.RequestParameterWrapper;
import com.wuseguang.springcloud.service.AchievementService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/jurisdiction")
public class AchievementController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private AchievementService service;

    /**
     * @描述 教师端小程序（成绩查询）
     * @创建人 zm
     * @创建时间 2020/6/24
     */
    @RequestMapping("/querySchoolAchievementAll")
    public Result querySchoolAchievementAll(RequestParameterWrapper request,
                                            @RequestParam(value = "indexNo", required = false, defaultValue = "1") Integer indexNo,
                                            @RequestParam(value = "rows", required = false, defaultValue = "20") Integer rows) {

        //学期id
        //String termId = request.getParam("termId");
        //学校id
        String schoolId = request.getParam("schoolId");
        //管理员
        String admin = request.getParam("admin");
        //教师id
        String teacherId = request.getParam("teacherId");

        return service.querySchoolAchievementAll(admin, schoolId, teacherId, indexNo, rows);
    }


    /**
     * @描述 （教师小程序）成绩页详情
     * @创建人 zm
     * @创建时间 2020/6/24
     */
    @RequestMapping("/querySchoolAchievementById")
    public Result queryScoreStatistics(@RequestParam(value = "id") Integer id,
                                       @RequestParam(value = "type") Integer type) {
        logger.info("querySchoolAchievementById,id={},type={}", id, type);
        return service.querySchoolAchievementById(id, type);
    }
}
